; (function () {
    //关注我们的下拉
    $(function () {
        $(".e").on("mouseenter", ".e_show", function () {
            $(this).parent().find(".e_down").show()
        })
        $(".e").on("mouseleave", ".e_show", function () {
            $(this).parent().find(".e_down").hide()
        })
    })

    //移入左边menuBoxDowm1添加边框,mid_infBox显示
    $(function(){
        $(".menuBoxDown1 li").on("mouseenter",function(){
            $(this).find(".mid_infBox").css("display","block");
            $(this).css("border","1px solid red")
            $(this).css("border-right","none")
            $(this).parents(".menu").find(".menuBoxDown2").css("display","none")
        });
        $(".menuBoxDown1 li").on("mouseleave",function(){
            $(this).find(".mid_infBox").css("display","none");
            $(this).css("border","none");
            $(this).parents(".menu").find(".menuBoxDown2").css("display","block")
        })
    })

    //移入mid_infBox,里面的a变红
    $(function(){
        $(".mid_infBox dd a").on("mouseenter",function(){
            $(this).css("color","red")
        }).on("mouseleave",function(){
            $(this).css("color","#666")
        })
    })

    //领劵中心和刊物下载
    $(function () {
        $(".down3_1_1").on("mouseenter", function () {
            $(this).parents(".down3").find("img").attr("src", "./images/12.jpg");
            $(this).css("backgroundColor","red").siblings().css("backgroundColor","")
        })
        $(".down3_1_2").on("mouseenter", function () {
            $(this).parents(".down3").find("img").attr("src", "./images/13.jpg");
            $(this).css("backgroundColor","red").siblings().css("backgroundColor","")
        })
    })

     //nav鼠标移入更换图片
     $(function () {
        $(".nav>ul>li").on("mouseenter", function () {
            $(this).find("a").css("top", "-98px")
        }).on("mouseleave", function () {
            $(this).find("a").css("top", "0px")
        })
    })

    //p_box鼠标移入更换图片
    $(function () {
        $(".p_box>.p_box_1").on("mouseenter", function () {
            $(this).find(".p_box_1_1").css("height", 0)
            $(this).find(".p_box_1_2").css("height", 90)
        }).on("mouseleave", function () {
            $(this).find(".p_box_1_1").css("height", 90)
            $(this).find(".p_box_1_2").css("height", 0)
        })
    })

    //滚轮事件,滚动滚轮,到150px的时候,顶部的导航栏出现
    $.fn.extend({
        topShow(num = 150) {
            let self = this
            $(window).on("scroll", function () {
                var srcTop = $(this).scrollTop()
                if (srcTop > num) {
                    $(self).css("display", "block")
                } else {
                    $(self).css("display", "none")
                }
            })
        }
    })
    $(function () {
        $(".src_Box").topShow()
    })

    //鼠标移入右边固定导航栏,弹出文字和改变颜色
    $(function () {
        $(".winBox li").on("mouseenter", function () {
            $(this).find("b").css("display", "block")
            $(this).find("i").css("backgroundColor", "red")
        }).on("mouseleave", function () {
            $(this).find("b").css("display", "none")
            $(this).find("i").css("backgroundColor", "#666")
        })
    })
    $(function () {
        $(".backTop").on("mouseenter", function () {
            $(this).find("b").css("display", "block")
            $(this).find("i").css("backgroundColor", "red")
        }).on("mouseleave", function () {
            $(this).find("b").css("display", "none")
            $(this).find("i").css("backgroundColor", "#666")
        })
    })
    //点击回到顶部
    $(function () {
        $(".backTop").on("click", function () {
            $("html,body").animate({
                scrollTop: 0
            })
        })
    })

    //懒加载
    $(function () {
        $("img.lazy").lazyload({ effect: "fadeIn" });
    });

    //轮播图
    class Swiper {
        constructor(el) {
            this.$el = el;
            this.$oUl = this.$el.find("ul");
            this.$oOl = this.$el.find("ol");
            this.index = 0;
            this.autoPlay();
            this.mouseHander();
            this.mouseMove();
            this.clickMove();
            this.timer = setInterval(() => {
                this.index++;
                this, this.autoPlay();
            }, 1500)
        }
        autoPlay() {
            if (this.index > this.$oUl.children().length - 1) {
                this.index = 0;
            }
            this.$oUl.children().eq(this.index).animate({ opacity: 1 }).siblings().animate({ opacity: 0 })
            this.$oOl.children().eq(this.index).css("backgroundColor", "#fff").siblings().css("backgroundColor", "")
        }
        mouseHander() {
            this.$el.on("mouseenter", () => {
                clearInterval(this.timer);
            })
            this.$el.on("mouseleave", function () {
                this.timer = setInterval(() => {
                    this.index++;
                    this.autoPlay()
                }, 1500)
            }.bind(this))
        }
        mouseMove() {
            let self = this;
            this.$oOl.on("mouseenter", "li", _.debounce(function () {
                // this.index = $(this).index();
                // console.log($(this).index());
                self.index = $(this).index()
                self.autoPlay();
            }, 400))
        }
    }
    $.fn.extend({
        changeImg() {
            new Swiper(this)
        }
    })
    $(function () {
        $(".banner").changeImg();
    })
})();